ArcDir
An extension to dopus request, is the dopus getstring command, which
allows the user to input a string instead of just choosing a button.
The following example asks you for your name, only allows you to input 15
characters maximum, and displays a default name of 'Jon Potter', which you
can use backspace to erase and then input your own.
If you then click on the 'Okay' button, any text you typed in will be in
the standard ARexx variable RESULT .
The value of the button you used will be returned in the special Opus
variable DOPUSRC .
/* DOpusGetstring.dopus5 */
options results
lf = '0a'x
address 'DOPUS.1'
dopus getstring '"Please enter your name" 15 "Jon Potter" Okay|Cancel'
if dopusrc = -1 then what = 'pressed Enter'
if dopusrc = 1 then what = 'chose Okay'
if dopusrc = 0 then what = 'chose Cancel'
text = 'You 'what||lf||'The value of DOPUSRC was: 'dopusrc
dopus request '"'text'" OK'
text = "Your name is: "result
dopus request '"'text'" OK'
exit
If you clicked on the 'Cancel' button, the RESULT variable will be cleared
of any string and DOPUSRC will contain the value 0.
If you clicked the 'Okay' button then RESULT will contain any text, (or
none), that was in the string gadget, and DOPUSRC will have the value of 1.
If you hit the Return/Enter key to enter your name, then RESULT will
contain any text typed in, and DOPUSRC variable will be -1.
|